/*******************************************************************************
* Copyright (c) 2010, 2018 西安秦晔信息科技有限公司
* Licensed under the Apache License, Version 2.0 (the "License");
*    you may not use this file except in compliance with the License.
*    You may obtain a copy of the License at
*
*       http://www.apache.org/licenses/LICENSE-2.0
*
*    Unless required by applicable law or agreed to in writing, software
*    distributed under the License is distributed on an "AS IS" BASIS,
*    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*    See the License for the specific language governing permissions and
*    limitations under the License.
*******************************************************************************/
package com.qinyeit.serviceapp.service.materials;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.qinyeit.serviceapp.entity.DishesCategory;
import com.qinyeit.serviceapp.entity.MaterialCategory;
import com.qinyeit.serviceapp.entity.enums.InventoryType;
import com.qinyetech.springstage.core.entity.search.Searchable;
import com.qinyetech.springstage.core.lang.QyMap;
import com.qinyetech.springstage.core.service.IBaseService;
import com.qinyeit.serviceapp.entity.Material;
import org.springframework.data.domain.Page;

import java.util.List;
import java.util.Map;

/** 
 * ClassName: MaterialService <br/> 
 * Function: 物品管理业务功能 <br/> 
 * date: 2018-11-07 11:42:52 <br/> 
 * 
 * @author liuwenjin
 * @version 1.0
 * @since JDK 1.8
 */
public interface MaterialService extends IBaseService<Material, Long>{

    /**
     *
     * @param materials：
     *                 material:原料
     *                 purchase:规格
     */
    QyMap saveData(JSONObject materials,Long merchantGroupId);

    /**
     * 保存多采购规格
     * @param merchantGroupId
     * @param material 原料
     * @param purchaseJson [{
     *
     *                      }]
     */
    QyMap savePurchaseSpecs(Long merchantGroupId, Material material, JSONArray purchaseJson);

    /**
     * 保存规格的原料id
     * @param ids 采购规格ids
     * @param materialId
     */
    void savePurchaseMaterial(List<Long> ids,Long materialId);
    /**
     * 获取商品  出库 / 调拨 /
     * @param merchantGroupId
     * @param warehouseId
     * @param keywords 关键字 按商品名称/编码/简码/拼音
     * @param categoryId 类别id
     * @param inventoryType 盘点类型
     * @return
     */
    Page<Map<String,Object>> getMaterialsForOut(Long merchantGroupId, Searchable searchable,Long warehouseId, String keywords, Long categoryId, String inventoryType, Boolean pandian,Long storeId);
    /**
     * 获取商品  盘点
     * @param merchantGroupId
     * @param warehouseId
     * @param keywords 关键字 按商品名称/编码/简码/拼音
     * @param categoryId 类别id
     * @param inventoryType 盘点类型
     * @return
     */
    List<Map<String,Object>> getMaterialsForPandian(Searchable searchable,Long merchantGroupId,Long warehouseId, String keywords, Long categoryId, String inventoryType, Boolean pandian,Long storeId);

    /**
     * 根据uuid 获取物料
     * @param uuid
     * @return
     */
    Material getMaterialByUUid(String uuid,Long merchantGroupId);


    /**
     * 获取下一个编号
     * @param defNo
     * @return
     */
    String getNextNo(String defNo,Long merchantGroupId);

    /**
     * 获取原料 类别 - 》 原料s[dddd]
     * @param storeId
     * @param authenticatedMerchantGroupID
     * @return
     */
    List<MaterialCategory> getMaterialByStoreId(Long storeId, Long authenticatedMerchantGroupID);
}